[#ftl]
[#--  统一命名规则方便维护 --]
[#function PreIdFunc data_main mdx]
[#return (mdx.methodCode1+'-'+data_main.moduleKey) ]
[/#function]
[#function DlgIdFunc data_main mdx]
[#return ('dlg-'+PreIdFunc(data_main,mdx)) ]
[/#function]
[#function TableIdFunc data_main mdx]
[#return ('tbl-'+PreIdFunc(data_main,mdx)) ]
[/#function]
[#function TableBarIdFunc data_main mdx]
[#return ('tb-'+PreIdFunc(data_main,mdx)) ]
[/#function]
[#function TableBtnIdFunc data_main mdx]
[#return ('tbbtn-'+PreIdFunc(data_main,mdx)) ]
[/#function]
[#function DlgMethodNameFunc data_main mdx]
[#return ('dlg'+MethodNameFunc(data_main,mdx)) ]
[/#function]
[#function DlgTitleConstFunc data_main]
[#return ('Title'+data_main.moduleKey?cap_first) ]
[/#function]
[#function DlgTitleFunc data_main mdx]
[#return (DlgTitleConstFunc(data_main)+'+\'-'+mdx.methodKeyName+'\'') ]
[/#function]
[#function TableMethodNameFunc data_main mdx]
[#return ('tableInit'+MethodNameFunc(data_main,mdx)) ]
[/#function]

[#function MethodNameFunc data_main mdx]
[#return (mdx.methodKey?cap_first+data_main.moduleKey?cap_first) ]
[/#function]

[#function MethodUrlFunc data_main mdx]
[#return (ControllerUrl(data_main)+mdx.methodUrl) ]
[/#function]

[#function ControllerUrl data_main]
[#return ('/'+data_main.outputModulePath+'/'+data_main.moduleKey+'/') ]
[/#function]
[#function ControllerMethodTitle data_main mdx]
[#return (data_main.moduleKeyName +'-'+ mdx.methodKeyName) ]
[/#function]
[#function ControllerMethodName data_main mdx]
[#return (mdx.methodKey + data_main.moduleKey?cap_first) ]
[/#function]
[#function ServiceMethodName data_main mdx]
[#return (MethodNameFunc(data_main,mdx)) ]
[/#function]

[#-- 切换表格明细显示 --]
[#macro JsToggleHandler]
function toggleTable(){
    $('#table-toggle').switchbutton({
      checked:true,
      handleText:'明细',
      width:75,
      height:25,
      handleWidth:35,
      onChange:function(checked){
        if(checked){
          ccJSON['TableToggleFlag'] = true;
          $('#p-all').layout('expand','east');
          if(ccJSON['TableSelectFlag']){//展开时触发查询
              zUtil.valAll('${'#'+DlgIdFunc(data_main2,qmdx2)}',ccJSON['TableSelectParam']);
              zUtil.tableQuery('${'#'+TableIdFunc(data_main2,qmdx2)}',ccJSON['TableSelectParam'],{url:zGlobal["http"] + "${MethodUrlFunc(data_main2,qmdx2)}"});
          }
        }else{
          ccJSON['TableToggleFlag'] = false;
          $('#p-all').layout('collapse','east');
        }
        $('#p-all .layout-expand.layout-expand-east').addClass('disabled');
      }
    });
}
[/#macro]
[#--  查询表格初始化 --]
[#function JsTableIdField eList]
[#assign idField='' /]
[#list eList as b][#if (b.fieldEx['keyFlag']!'0')=="1"][#assign idField=b.fieldJavaCode /][#break][/#if][/#list]
[#return idField ]
[/#function]
[#function JsTableSortName eList]
[#assign sortName='' /]
[#list eList as b][#if (b.fieldEx['sortKey']!'0')=="1"][#assign idField=b.fieldJavaCode /][#break][#break][/#if][/#list]
[#return sortName ]
[/#function]
[#macro JsTableHandler data_main data_method map_method leftFlag]
[#if map_method[f_query]??]
    [#assign mdx=map_method[f_query]  buttonSize=0  eList=mdx.orderEntitys[f_res]![] /]
    [#list data_method as mdx]
    [#if mdx.needFlag == '1' && ([f_edit,f_detail,f_del]?seq_contains(mdx.methodKey))]
    [#assign buttonSize += 40 /]
    [/#if]
    [/#list]
    zUtil.tableInit('${'#'+TableIdFunc(data_main,mdx)}',{
        queryParams:{},
        url : [#if leftFlag]zGlobal["http"] + "${MethodUrlFunc(data_main,mdx)}"[#else]''[/#if],
        idField: '${JsTableIdField(eList)}',
        sortName: '${JsTableSortName(eList)}',
        sortOrder: 'desc',
        toolbar: '${'#'+TableBarIdFunc(data_main,mdx)}',
        columns:[[
            [#list eList as b]
            [#if (b.fieldUseType=="1" || b.fieldUseType=="2") && (b.fieldEx['frozenFlag']!'0')=="0"]
            {field: '${b.fieldJavaCode}', title: '${b.fieldTitle}', align: 'center', width: ${((b.inputClass!'')?length>0)?then(b.inputClass,'100')}[#if (b.fieldEx['sortKey']!'0')=="1"], sortable: true[/#if][#if b.pageShowFlag=="0"], hidden:true[/#if][#if (b.fieldEx['formatterFlag']!'0')=="1"]
              , formatter: function(value,rowData,rowIndex){ return zUtil.dictConvertOf${(data_main.loadDictFunc!'sys')?cap_first}(value,"${b.inputDict!''}"); }[/#if]},
            [/#if]
            [/#list]
            {field: '_blank', title: ' ', align: 'center', width: 30},
        ]],
        frozenColumns:[[
            //{field:'', title:'', align:'center', checkbox:true},
            [#if buttonSize != 0 ]
            {field:'buttonArr', title:'操作', align:'center', width: ${buttonSize}
            , formatter: function(value,rowData,rowIndex){
              var btarr =[];
              [#list data_method as mdx]
              [#if mdx.needFlag == '1' && ([f_edit,f_detail,f_del]?seq_contains(mdx.methodKey))]
              btarr.push('<a href="javascript:void(0);" class="${mdx.fieldEx['btnClass']!'easyui-linkbutton'}" onclick="${DlgMethodNameFunc(data_main,mdx)}('+rowIndex+');" title="${mdx.methodKeyName}" ><i class="${mdx.fieldEx['btnIcon']!''}"></i></a>');
              [/#if]
              [/#list]
              return '<div style="height:100%;">' + btarr.join(' ') + '</div>';
            }},
            [/#if]
            [#list eList as b]
            [#if (b.fieldUseType=="1" || b.fieldUseType=="2") && (b.fieldEx['frozenFlag']!'0')=="1"]
            {field: '${b.fieldJavaCode}', title: '${b.fieldTitle}', align: 'center', width: ${((b.inputClass!'')?length>0)?then(b.inputClass,'100')} },
            [/#if]
            [/#list]
        ]],
        onHeaderContextMenu: function(e, field){
            ccJSON['${'THeaderMenu'+MethodNameFunc(data_main,mdx)}'] = zUtil.tableHeaderMenu(e,ccJSON['${'THeaderMenu'+MethodNameFunc(data_main,mdx)}'],'${'#'+TableIdFunc(data_main,mdx)}');
        },
        [#if leftFlag && toggleFlag?length>0]
        onSelect: function(rowIndex, rowData){[#-- 也可以写成多个字段 --]
            var lastSelectId = ccJSON['TableSelectFlag'];
            ccJSON['TableSelectFlag'] = rowData['[#list eList as b][#if (b.fieldEx['keyFlag']!'0')=="1"]${b.fieldJavaCode}[#break][/#if][/#list]'];
            ccJSON['TableSelectParam'] = {};
            var p = ccJSON['TableSelectParam'];
            [#list eList as b]
            [#if (b.fieldEx['toggleField']!'0')=="1"]
            p['${b.fieldJavaCode}'] = rowData['${b.fieldJavaCode}'];
            [/#if]
            [/#list]
            [#list eList as b]
            [#if (b.fieldEx['toggleField']!'0')=="1"]
            zUtil.readonly('${'#'+PreIdFunc(data_main2,qmdx2)+'-'+b.fieldJavaCode}');
            [/#if]
            [/#list]
            zUtil.valAll('${'#'+DlgIdFunc(data_main2,qmdx2)}',p);
            if(ccJSON['TableToggleFlag'] && lastSelectId !== rowData['[#list eList as b][#if (b.fieldEx['keyFlag']!'0')=="1"]${b.fieldJavaCode}[#break][/#if][/#list]']){
                zUtil.tableQuery('${'#'+TableIdFunc(data_main2,qmdx2)}',p,{url:zGlobal["http"] + "${MethodUrlFunc(data_main2,qmdx2)}"});
            }
        },
        onLoadSuccess: function(data){
            try{//放后面加载的
                zUtil.formClear('${'#'+DlgIdFunc(data_main2,qmdx2)}');
                zUtil.tableData('${'#'+TableIdFunc(data_main2,qmdx2)}',[]);
            }catch(b){}
            ccJSON['TableSelectFlag'] = null;
            ccJSON['TableSelectParam'] = null;
        }
        [/#if]
    });
    
    [/#if]
[/#macro]
[#--  功能方法初始化,这里参数简化处理即可 --]
[#macro JsMethodHandler data_main data_method map_method leftFlag]
[#list data_method as mdx]
[#if mdx.methodKey == f_query]
//${data_main.moduleKeyName+"-"+mdx.methodKeyName}
function ${TableMethodNameFunc(data_main,mdx)}(){
[@JsTableHandler data_main  data_method  map_method  leftFlag /]
}
[#if mdx.needFlag == '1']
function ${DlgMethodNameFunc(data_main,mdx)}(){
    [#assign eList=mdx.orderEntitys[f_res]![] /]
    [@InputInitHandler data_main  PreIdFunc(data_main,mdx)  ''  mdx.orderEntitys[f_req]![] /]
    [@InputReadonlyHandler  PreIdFunc(data_main,mdx)  ''  mdx.orderEntitys[f_req]![] /]
    [#if !leftFlag && toggleFlag?length>0]
    if(!ccJSON['TableSelectParam']){
        zUtil.msg('未选择左侧数据');
        return;
    }
    [/#if]
    var dlgSave = function(){
      var queryParams = zUtil.valAll('${'#'+DlgIdFunc(data_main,mdx)}');
      zUtil.tableUnSelected('${'#'+TableIdFunc(data_main,mdx)}');
      zUtil.tableQuery('${'#'+TableIdFunc(data_main,mdx)}',queryParams);
    };
    var dlgClear = function(){
      zUtil.formClear('${'#'+DlgIdFunc(data_main,mdx)}');
      [#if !leftFlag && toggleFlag?length>0]
      zUtil.valAll('${'#'+DlgIdFunc(data_main,mdx)}',ccJSON['TableSelectParam']);
      [/#if]
    };
    var dlgClose = function(){
      zUtil.dialogClose('${'#'+DlgIdFunc(data_main,mdx)}');
    };
    var dlgOptions = {
      title: ${DlgTitleFunc(data_main,mdx)},
      onOpen:function(){
      }
    };
    var dlgButtonsIdx = [0,1,2];
    var dlgButtonsFunc =  [dlgSave,dlgClear,dlgClose];
    zUtil.queryInit('${'#'+DlgIdFunc(data_main,mdx)}',dlgOptions,dlgButtonsIdx,dlgButtonsFunc);
    zUtil.dialogOpen('${'#'+DlgIdFunc(data_main,mdx)}');
}
[/#if]

[#elseif mdx.methodKey == f_detail]
[#if mdx.needFlag == '1']
//${data_main.moduleKeyName+"-"+mdx.methodKeyName}
function ${DlgMethodNameFunc(data_main,mdx)}(rowIndex){
    [#assign qmdx = map_method[f_query] dmdx = map_method[f_detail] /]
    var row = rowIndex;
    if($.isNumeric(rowIndex)){
        zUtil.tableSelected('${'#'+TableIdFunc(data_main,qmdx)}',rowIndex);
        row = zUtil.tableRows('${'#'+TableIdFunc(data_main,qmdx)}');
    }
    zUtil.formClear('${'#'+DlgIdFunc(data_main,mdx)}');
    zUtil.readonlyAll('${'#'+DlgIdFunc(data_main,mdx)}');
    [@InputInitHandler data_main  PreIdFunc(data_main,mdx)  ''  mdx.orderEntitys[f_res]![] /]
    
    var dlgClose = function(){
      zUtil.dialogClose('${'#'+DlgIdFunc(data_main,mdx)}');
    };
    var dlgOptions = {
       title: ${DlgTitleFunc(data_main,mdx)},
       onOpen:function(){
          ${'get'+MethodNameFunc(data_main,dmdx)}(row,'${'#'+DlgIdFunc(data_main,mdx)}');
       }
    };
    var dlgButtonsIdx = [1];
    var dlgButtonsFunc =  [dlgClose];
    zUtil.dialogInit('${'#'+DlgIdFunc(data_main,mdx)}',dlgOptions,dlgButtonsIdx,dlgButtonsFunc);   
    zUtil.dialogOpen('${'#'+DlgIdFunc(data_main,mdx)}');
}
[/#if]
[#elseif mdx.methodKey == f_add]
[#if mdx.needFlag == '1']
//${data_main.moduleKeyName+"-"+mdx.methodKeyName}
function ${DlgMethodNameFunc(data_main,mdx)}(rowIndex){
    [#assign qmdx = map_method[f_query] /]
    [#if !leftFlag && toggleFlag?length>0]
    if(!ccJSON['TableSelectParam']){
        zUtil.msg('未选择左侧数据');
        return;
    }
    [/#if]
    var row = rowIndex;
    zUtil.formClear('${'#'+DlgIdFunc(data_main,mdx)}');
    zUtil.readonlyAll('${'#'+DlgIdFunc(data_main,mdx)}',false);
    [@InputInitHandler data_main  PreIdFunc(data_main,mdx)  ''  mdx.orderEntitys[f_req]![] /]
    [@InputReadonlyHandler PreIdFunc(data_main,mdx)  ''  mdx.orderEntitys[f_req]![] /]
    [#if !leftFlag && toggleFlag?length>0]
    zUtil.valAll('${'#'+DlgIdFunc(data_main,mdx)}',ccJSON['TableSelectParam']);
    [/#if]
    
    var dlgSave = function(){
      if(!zUtil.formCheck('${'#'+DlgIdFunc(data_main,mdx)}')){
        return false;
      };
      var params = zUtil.valAll('${'#'+DlgIdFunc(data_main,mdx)}');
      var reqData = {reqData: params};
      zUtil.ajaxPost(zGlobal["http"] + "${MethodUrlFunc(data_main,mdx)}", reqData
      ,function(result){
        if(zCode["GLOBAL_SUCCESS"] == zUtil.getVal(result,zConst["busCode"])){
          var queryParams = zUtil.valAll('${'#'+DlgIdFunc(data_main,qmdx)}');
          zUtil.tableQuery('${'#'+TableIdFunc(data_main,qmdx)}',queryParams);
          zUtil.dialogClose('${'#'+DlgIdFunc(data_main,mdx)}');
        }else{
          zUtil.msg('保存失败,'+result[zConst["busMsg"]]);
        }
      });
    };
    var dlgClose = function(){
      zUtil.dialogClose('${'#'+DlgIdFunc(data_main,mdx)}');
    };
    var dlgOptions = {
      title: ${DlgTitleFunc(data_main,mdx)},
      onOpen:function(){
      }
    };
    var dlgButtonsIdx = [0,1];
    var dlgButtonsFunc =  [dlgSave,dlgClose];
    zUtil.dialogInit('${'#'+DlgIdFunc(data_main,mdx)}',dlgOptions,dlgButtonsIdx,dlgButtonsFunc);   
    zUtil.dialogOpen('${'#'+DlgIdFunc(data_main,mdx)}');
}
[/#if]
[#elseif mdx.methodKey == f_edit]
[#if mdx.needFlag == '1']
//${data_main.moduleKeyName+"-"+mdx.methodKeyName}
function ${DlgMethodNameFunc(data_main,mdx)}(rowIndex){
    [#assign qmdx = map_method[f_query]  dmdx = map_method[f_detail] /]
    var row = rowIndex;
    if($.isNumeric(rowIndex)){
      zUtil.tableSelected('${'#'+TableIdFunc(data_main,qmdx)}',rowIndex);
      row = zUtil.tableRows('${'#'+TableIdFunc(data_main,qmdx)}');
    }
    zUtil.formClear('${'#'+DlgIdFunc(data_main,mdx)}');
    zUtil.readonlyAll('${'#'+DlgIdFunc(data_main,mdx)}',false);
    
    [@InputInitHandler data_main  PreIdFunc(data_main,mdx)  ''  mdx.orderEntitys[f_req]![] /]
    [@InputReadonlyHandler PreIdFunc(data_main,mdx)  ''  mdx.orderEntitys[f_req]![] /]
    
    var dlgSave = function(){
      if(!zUtil.formCheck('${'#'+DlgIdFunc(data_main,mdx)}')){
        return false;
      };
      var params = zUtil.valAll('${'#'+DlgIdFunc(data_main,mdx)}');
      var reqData = {reqData: params};
      zUtil.ajaxPost(zGlobal["http"] + "${MethodUrlFunc(data_main,mdx)}", reqData
      ,function(result){
        if(zCode["GLOBAL_SUCCESS"] == zUtil.getVal(result,zConst["busCode"])){
          var queryParams = zUtil.valAll('${'#'+DlgIdFunc(data_main,qmdx)}');
          zUtil.tableQuery('${'#'+TableIdFunc(data_main,qmdx)}',queryParams);
          zUtil.dialogClose('${'#'+DlgIdFunc(data_main,mdx)}');
        }else{
          zUtil.msg('保存失败,'+result[zConst["busMsg"]]);
        }
      });
    };
    var dlgClose = function(){
      zUtil.dialogClose('${'#'+DlgIdFunc(data_main,mdx)}');
    };
    var dlgOptions = {
      title: ${DlgTitleFunc(data_main,mdx)},
      onOpen:function(){
          ${'get'+MethodNameFunc(data_main,dmdx)}(row,'${'#'+DlgIdFunc(data_main,mdx)}');
      }
    };
    var dlgButtonsIdx = [0,1];
    var dlgButtonsFunc =  [dlgSave,dlgClose];
    zUtil.dialogInit('${'#'+DlgIdFunc(data_main,mdx)}',dlgOptions,dlgButtonsIdx,dlgButtonsFunc);   
    zUtil.dialogOpen('${'#'+DlgIdFunc(data_main,mdx)}');
}
[/#if]
[#elseif mdx.methodKey == f_del]
[#if mdx.needFlag == '1']
//${data_main.moduleKeyName+"-"+mdx.methodKeyName}
function ${DlgMethodNameFunc(data_main,mdx)}(rowIndex){
    [#assign qmdx = map_method[f_query] /]
    var row = rowIndex;
    if($.isNumeric(rowIndex)){
      zUtil.tableSelected('${'#'+TableIdFunc(data_main,qmdx)}',rowIndex);
      row = zUtil.tableRows('${'#'+TableIdFunc(data_main,qmdx)}');
    }
    
    var reqData = {reqData: row};
    var okfunc = function(){
      zUtil.ajaxPost(zGlobal["http"] + "${MethodUrlFunc(data_main,mdx)}", reqData
      ,function(result){
        if(zCode["GLOBAL_SUCCESS"] == zUtil.getVal(result,zConst["busCode"])){
          var queryParams = zUtil.valAll('${'#'+DlgIdFunc(data_main,qmdx)}');
          zUtil.tableQuery('${'#'+TableIdFunc(data_main,qmdx)}',queryParams);
        }else{
          zUtil.msg('操作失败,'+result[zConst["busMsg"]]);
        }
      });
    }
    zUtil.msgConfirm("删除选中记录?",okfunc);
}
[/#if]
[#else]
[#if mdx.needFlag == '1']
function ${DlgMethodNameFunc(data_main,mdx)}(rowIndex){
}
[/#if]

[/#if]
[/#list]
[#if map_method[f_detail]??]
[#assign mdx = map_method[f_detail]]
[#if mdx.needFlag == '1']
//${data_main.moduleKeyName+"-"+mdx.methodKeyName}
function ${'get'+MethodNameFunc(data_main,mdx)}(row,el){
    [#assign eList = mdx.orderEntitys[f_req]![] /]
    var params = {};[#-- 后台隔离了字段也可以传整个对象,params = row --]
    [#list eList as b]
    [#if b.fieldUseType=="1" || b.fieldUseType=="2" ]
    params['${b.fieldJavaCode}']  = row['${b.fieldJavaCode}'];
    [/#if]
    [/#list]
    zUtil.ajaxPost(zGlobal["http"] + "${MethodUrlFunc(data_main,mdx)}", {reqData:params}
    ,function(result){
       if(zCode["GLOBAL_SUCCESS"] != zUtil.getVal(result,zConst["busCode"])){
         zUtil.msg('获取信息失败');
         return false;
       }
       zUtil.valAll(el,result[zConst["resData"]]);
    });
   
}
[/#if]
[/#if]
[/#macro]
[#macro DictArrHandler data_main data_method]
    [#list data_method as mdx]
    [#if mdx.dictData?? && mdx.dictData?size>0 && mdx.needFlag == '1' && [f_edit,f_detail,f_query,f_add]?seq_contains(mdx.methodKey)]
    [#list (mdx.dictData)?keys as key]
    CurrentDictNames['${key}'] = '[#list mdx.dictData[key] as dx]${'#'+PreIdFunc(data_main,mdx)+'-'+dx.fieldJavaCode}[#if dx?has_next],[/#if][/#list]';
    [/#list]
    zUtil.selectFill(null,CurrentDictNames,${'zDict'+(data_main.loadDictFunc!'sys')?cap_first});
    [/#if]
    [/#list]
[/#macro]
[#--  按钮元素 --]
[#macro ButtonHandler data_main data_method]
      [#list data_method as mdx]
      [#if mdx.methodKey == f_add || mdx.methodKey == f_query]
         <a href="javascript:void(0);" class="${mdx.fieldEx['btnClass']!'easyui-linkbutton'}" id="${TableBtnIdFunc(data_main,mdx)}" onclick="${DlgMethodNameFunc(data_main,mdx)+'();'}"> <i class="fa ${mdx.fieldEx['btnIcon']!''}">${mdx.methodKeyName}</i></a>
      [/#if]
      [/#list]
[/#macro]
[#--  初始化弹框 --]
[#macro DlgDivHandler data_main mdx entityType]
<!---分割--${data_main.moduleKeyName+"-"+mdx.methodKeyName}-------------------------------------------------------------------------------->
<div id="${DlgIdFunc(data_main,mdx)}" class="main-content" style="display:none;"> 
<form>
[#if mdx.fieldEx['layoutType'] == '1' && mdx.orderEntitys?? && (mdx.orderEntitys?size>0) ]
    [@DlgDivChildHandler mdx  PreIdFunc(data_main,mdx)  ''  ''  mdx.orderEntitys[entityType]![] /]
[#elseif mdx.fieldEx['layoutType'] == '3' && mdx.orderEntitys?? && (mdx.orderEntitys?size>0) ]
[#assign entityVO = mdx.groupNames[entityType] /]
[#assign entityVO2 = mdx.groupEntitys[entityType] /]
  <div class="overflow-n" style="padding-top: 51px;">
    <nav id="scroll-${PreIdFunc(data_main,mdx)}" class="navbar navbar-default" style="width:100%;position: absolute;z-index:1;top:0;margin: unset;">
       <ul class="nav navbar-nav">
          [#if entityVO?exists]
          [#list entityVO?keys as key]
          <li [#if key_index ==0]class="active"[/#if]><a href="#${PreIdFunc(data_main,mdx)+'-'+key}">${entityVO[key]!'默认'}</a></li>
          [/#list]
          [/#if]
       </ul>
    </nav>
    <div data-spy="scroll" data-target="#scroll-${PreIdFunc(data_main,mdx)}" class="overflow-y">
      [#if entityVO?exists]
      [#list entityVO?keys as key]
      <div id="${PreIdFunc(data_main,mdx)+'-'+key}" >
        <div class="row"> 
        <div class="col-sm-12">
          <fieldset> 
            <legend class="text-info">${entityVO[key]}</legend>
          </fieldset>
        </div>
        </div>
        [@DlgDivChildHandler mdx  PreIdFunc(data_main,mdx)  ''  ''  entityVO2[key] /]
      </div>
      [/#list]
      [/#if]
    </div>
  </div>
[#elseif mdx.fieldEx['layoutType'] == '2' && mdx.orderEntitys?? && (mdx.orderEntitys?size>0) ]
[#assign entityVO = mdx.groupNames[entityType] /]
[#assign entityVO2 = mdx.groupEntitys[entityType] /]
  <ul id="tab-${PreIdFunc(data_main,mdx)}" class="nav nav-tabs">
    [#if entityVO?exists]
    [#list entityVO?keys as key]
    <li [#if key_index ==0]class="active"[/#if] ><a href="#${PreIdFunc(data_main,mdx)+'-'+key}" data-toggle="tab">${entityVO[key]!'默认'}</a></li>
    [/#list]
    [/#if]
  </ul>
  <div id="tabContent-${PreIdFunc(data_main,mdx)}" class="tab-content">
    [#if entityVO?exists]
    [#list entityVO?keys as key]
    <div id="${PreIdFunc(data_main,mdx)+'-'+key}" class="tab-pane fade[#if key_index ==0] in active[/#if]">
      [@DlgDivChildHandler mdx  PreIdFunc(data_main,mdx)  ''  ''  entityVO2[key] /]
    </div>
    [/#list]
    [/#if]
  </div>
  
[/#if]
</form>
</div>
[/#macro]
[#--  初始化元素 --]
[#macro DlgDivChildHandler mdx dlgid tid parent vlist]
    [#assign vid=tid]
    [#if vid?length==0][#assign vid=dlgid][/#if]
    <div class="row">&nbsp;</div>
    <div class="row padding-right">
    [#if vlist?? && (vlist?size>0)]
    [#list vlist as b]
    [#if b.fieldUseType=="1" || b.fieldUseType=="2" ]
    [#if b.fieldType=="2"]
    [#if b.children?? && b.children?size>0]
    [@DlgDivChildHandler mdx  dlgid  vid  b.fieldJavaCode  b.children/]
    [/#if]
    [#else]
    [#assign gridClonums='12' /]
    [#if mdx.methodKey!=f_query]
    [#if (b.gridClonums!'')?length>0][#assign gridClonums= b.gridClonums /][#else][#assign gridClonums= '6' /][/#if]
    [/#if]
    <div [#if parent??&&parent?length>0]datalevel="${parent}"[/#if] class="col-xs-12 col-sm-${gridClonums}[#if b.pageShowFlag=='0'] hidden[/#if]">
      <label class="form-lable">${b.fieldTitle}</label>
      <div class="input-block">
        [#if b.componentType=="input"]
        <input id="${InputIdFunc(vid,b)}" name="${b.fieldJavaCode}" class="easyui-textbox" data-options="${InputOptsFunc(b)}" style="width:100%;" />
        [#elseif b.componentType=="text"]
        <input id="${InputIdFunc(vid,b)}" name="${b.fieldJavaCode}" class="easyui-textbox" data-options="multiline:true,${InputOptsFunc(b)}" style="width:100%;" />
        [#elseif b.componentType=="select"]
        <select id="${InputIdFunc(vid,b)}" name="${b.fieldJavaCode}" class="easyui-combobox" data-options="${InputOptsFunc(b)}" style="width:100%;" ></select>
        [#elseif b.componentType=="grid"]
        <input id="${InputIdFunc(vid,b)}" name="${b.fieldJavaCode}" class="easyui-combogrid" data-options="${InputOptsFunc(b)}" style="width:100%;" />
        [#elseif b.componentType=="table"]
        <div style="border: 1px solid #EEE;"><table id="${InputIdFunc(vid,b)}" name="${b.fieldJavaCode}" listlevel="${b.fieldJavaCode}" style="min-height:300px;"></table></div>
        [#elseif b.componentType=="label"]
        <label id="${InputIdFunc(vid,b)}" name="${b.fieldJavaCode}" style="width:100%;" ></label>
        [#elseif b.componentType=="checkbox"]
        <span class="textbox textbox2 easyui-fluid"><div class="input-g"><input id="${InputIdFunc(vid,b)}" name="${b.fieldJavaCode}" class="easyui-checkbox" data-options="${InputOptsFunc(b)}" /></div></span>
        [#elseif b.componentType=="radiobox"]
        <span class="textbox textbox2 easyui-fluid"><div class="input-g"><input id="${InputIdFunc(vid,b)}" name="${b.fieldJavaCode}" class="easyui-radiobutton" data-options="${InputOptsFunc(b)}" /></div></span>
        [#elseif b.componentType=="selecttree"]
        <input id="${InputIdFunc(vid,b)}" name="${b.fieldJavaCode}" data-options="${InputOptsFunc(b)}" style="" />
        [#else]

        [/#if]
      </div>
    </div>
    [/#if]
    [/#if]
    [/#list]
    [/#if]
    </div> 
    <div class="row">&nbsp;</div>
[/#macro]
[#--  初始化组件 --]
[#macro InputInitHandler data_main dlgid tid vlist]
[#assign vid=tid]
[#if vid?length==0][#assign vid=dlgid][/#if]
[#if vlist?? && (vlist?size>0)]
[#list vlist as b]
[#if b.fieldUseType=="1" || b.fieldUseType=="2" ]
[#if b.fieldType=="2"]
    [#if b.children?? && b.children?size>0]
    [@InputInitHandler data_main  dlgid  vid  b.children/]
    [/#if]
[#elseif b.componentType=="input" && (b.inputOptions1!'')?length>10 ]
    zUtil.inputInit('${'#'+InputIdFunc(vid,b)}','input',
    ${b.inputOptions1});
[#elseif b.componentType=="text" && (b.inputOptions1!'')?length>10]
    zUtil.inputInit('${'#'+InputIdFunc(vid,b)}','input',
    ${b.inputOptions1});
[#elseif b.componentType=="select" && (b.inputOptions1!'')?length>10]
    zUtil.inputInit('${'#'+InputIdFunc(vid,b)}','select',
    ${b.inputOptions1});
[#elseif b.componentType=="grid" && (b.inputOptions1!'')?length>10]
    zUtil.inputInit('${'#'+InputIdFunc(vid,b)}','cgrid',
    ${b.inputOptions1});
[#elseif b.componentType=="table"][#-- 引用其他模块也行 --]
    zUtil.tableInit('${'#'+InputIdFunc(vid,b)}',
     [#if (b.inputOptions1!'')?length>10]
      ${b.inputOptions1}
     [#elseif b.children?? && b.children?size>0]
     { columns:[[
              [#list b.children as b]
              {field: '${b.fieldJavaCode}', title: '${b.fieldTitle}', align: 'center', width: 100 [#if (b.fieldEx['formatterFlag']!'0')=="1"]
              , formatter: function(value,rowData,rowIndex){ return zUtil.dictConvertOf${(data_main.loadDictFunc!'sys')?cap_first}(value,"${b.inputDict!''}"); }[/#if]},
              [/#list]
      ]],
    [/#if] }
   );
[#elseif b.componentType=="selecttree" && (b.inputOptions1!'')?length>10]
    zUtil.inputInit('${'#'+InputIdFunc(vid,b)}','input',
    ${b.inputOptions1});
[#elseif b.componentType=="checkbox" && (b.inputOptions1!'')?length>10]
    zUtil.inputInit('${'#'+InputIdFunc(vid,b)}','check',
    ${b.inputOptions1});
[#elseif b.componentType=="radiobox" && (b.inputOptions1!'')?length>10]
    zUtil.inputInit('${'#'+InputIdFunc(vid,b)}','radio',
    ${b.inputOptions1});
[#elseif b.componentType=="label" && (b.inputOptions1!'')?length>10]
[/#if]
[/#if]
[/#list]
[/#if]
[/#macro]
[#--  只读设置 --]
[#macro InputReadonlyHandler dlgid tid vlist]
[#assign vid=tid]
[#if vid?length==0][#assign vid=dlgid][/#if]
[#if vlist?? && (vlist?size>0)]
[#list vlist as b]
[#if b.fieldUseType=="1" || b.fieldUseType=="2" ]
[#if b.fieldType=="2"]
    [#if b.children?? && b.children?size>0]
    [@InputReadonlyHandler dlgid  vid  b.children/]
    [/#if]
[#elseif b.componentType!="label" && (b.readonlyFlag!'0')=="1"]
    zUtil.readonly('${'#'+InputIdFunc(vid,b)}');
[/#if]
[/#if]
[/#list]
[/#if]
[/#macro]
[#function InputOptsFunc b]
[#return ((b.mustFlag!"0")=="1")?then('required:true,','')+((b.checkPage!"")?length>0)?then('validType:[\''+b.checkPage+'\']','') /]
[/#function]
[#function InputIdFunc vid b]
[#return vid+'-'+b.fieldJavaCode /]
[/#function]